getApp();

var o = null, n = !1;

wx.getStorageSync("token");

module.exports.ws_connect = function(e) {
    (o = wx.connectSocket({
        url: "ws://121.40.165.18:8800"
    })).onOpen(function(o) {
        n = !0, console.log("监听 WebSocket 连接打开事件。", o);
    }), o.onClose(function(o) {
        n = !1, console.log("监听 WebSocket 连接关闭事件。", o);
    }), o.onError(function(o) {
        n = !0, console.log("监听 WebSocket 错误。错误信息", o);
    }), o.onMessage(function(o) {
        console.log(o);
    });
}, module.exports.sendMsg = function(e, t) {
    console.log(e), n && (console.log("通过 WebSocket 连接发送数据", JSON.stringify(e)), o.send({
        data: JSON.stringify(e)
    }, function(o) {
        t(o);
    }));
};